package com.party.core.model.information;

import com.google.common.collect.Maps;
import com.party.core.model.commune.IntegralType;

import java.util.Map;

/**
 * @ClassName InformationTypeGenre
 * @Description
 * @Author shenliuhai
 * @Date 2020/2/18 10:36
 **/
public enum InformationTypeGenre {

    INFORMATIONTYPE_CATEGORY_ORDINARY(0, "普通类型"),

    INFORMATIONTYPE_CATEGORY_MUTUAL(1, "互助类型"),

    INFORMATIONTYPE_CATEGORY_JOIN(2, "联系类型");

    //状态码
    private Integer code;

    //状态值
    private String value;

    InformationTypeGenre(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public static String getValue(Integer code) {
        for (InformationTypeGenre typeGenre : InformationTypeGenre.values()) {
            if (typeGenre.getCode().equals(code)) {
                return typeGenre.getValue();
            }
        }
        return null;
    }

    public static Map<Integer, String> convertMap(){
        Map<Integer, String> map = Maps.newHashMap();
        for (InformationTypeGenre typeGenre : InformationTypeGenre.values()){
            map.put(typeGenre.getCode(), typeGenre.getValue());
        }
        return map;
    }

}
